home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / graphics / ifx_antique / antique_ppc.c < prev    next >
C/C++ Source or Header  |  1999-04-19  |  1KB  |  56 lines

  1. #include <stdio.h>
  2. #include <exec/types.h>
  3. #include <exec/nodes.h>
  4. #include <exec/lists.h>
  5. #include <exec/memory.h>
  6. #include <utility/tagitem.h>
  7. #include <powerup/ppclib/interface.h>
  8. #include <powerup/ppclib/message.h>
  9. #include <powerup/ppclib/tasks.h>
  10. #include <powerup/gcclib/powerup_protos.h>
  11.  
  12. struct StartupData
  13. {
  14.     ULONG    MsgCount;
  15. };
  16.  
  17. int    main(void)
  18. {
  19. struct StartupData    *StartupData;
  20. void            *PPCPort;
  21. void            *M68kMsg;
  22. ULONG            MsgCount;
  23. ULONG            i,j;
  24. ULONG *Body;
  25. ULONG w,le;
  26. UBYTE *b,*g;
  27.  
  28.   StartupData    =(struct StartupData *) PPCGetTaskAttr(PPCTASKTAG_STARTUP_MSGDATA);
  29.  
  30.   MsgCount    =    StartupData->MsgCount;
  31.  
  32.     if (PPCPort=(void*) PPCGetTaskAttr(PPCTASKTAG_MSGPORT))
  33.     {
  34.       for (i=0;i<MsgCount;i++)
  35.       {
  36.         PPCWaitPort(PPCPort);
  37.  
  38.         if (M68kMsg = PPCGetMessage(PPCPort))
  39.         {
  40.           Body = (ULONG *)PPCGetMessageAttr(M68kMsg, PPCMSGTAG_DATA);
  41.           g = (UBYTE *)Body[0];
  42.           b = (UBYTE *)Body[1];
  43.           w = Body[2];
  44.           le = Body[3];
  45.  
  46.           for(j=0;j<w;j++)
  47.           {
  48.              g[j+le] = ((int)g[j+le] * 215) >> 8;
  49.              b[j+le] = ((int)b[j+le] * 174) >> 8;
  50.           }
  51.           PPCReplyMessage(M68kMsg);
  52.         }
  53.       }
  54.     }
  55. }
  56.